﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GLYFrom.DiCi
{
    public partial class ChongZhi : Form
    {
        public ChongZhi()
        {
            InitializeComponent();
        }

        private void ChongZhi_Load(object sender, EventArgs e)
        {

        }

        private void but_QD_Click(object sender, EventArgs e)
        {
            //账户余额
            DataTable Table = DBHelper.select(string.Format("select * from T_YongHu where YHId='{0}'",GeRenXX.Id)); 
            int money=Convert.ToInt32(Table.Rows[0]["YuE"]);
            //账号
            string ZhangHao = this.text_ZhangHao.Text.Trim();
            //密码
            string MiMa = this.text_MiMa.Text.Trim();
            //充值金额
            int JE = Convert.ToInt32(this.text_inE.Text.Trim());
            //修改用户金额
            int sr = DBHelper.ZSG(string.Format("update T_YongHu set YuE='{0}' where ZhangHao='{1}' and MiMa='{2}'",money+JE,ZhangHao,MiMa));
            if (sr>0)
            {
                MessageBox.Show("充值成功!");

            }
            else
            {
                MessageBox.Show("充值失败,账号或密码错误...");
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DiCi.CaiPin from = new CaiPin();
            from.Show();
            this.Close();
        }
    }
}
